Skip to content

[Bugfix #535] Fix: af open cross-workspace file resolution#547

Merged
waleedkadous merged 1 commit intomainfrom
builder/bugfix-535-af-open-does-not-reliably-work
Feb 23, 2026
Merged

[Bugfix #535] Fix: af open cross-workspace file resolution#547
waleedkadous merged 1 commit intomainfrom
builder/bugfix-535-af-open-does-not-reliably-work

Conversation

@waleedkadous
Copy link
Contributor

Summary

af open derived workspace from the file's location instead of the user's CWD. When opening a file from workspace A that physically resides in workspace B, it opened in B's annotation viewer instead of A's.

Fixes #535

Root Cause

open.ts used findWorkspaceRoot(dirname(filePath)) to determine which workspace to target. This meant the workspace was always derived from where the file lives, not where the user is working. For cross-workspace file opens (e.g., opening a codev source file from the marketmaker workspace), the file tab was created in the wrong workspace's viewer.

Fix

Prefer CWD-based workspace detection (findWorkspaceRoot(process.cwd())), which correctly identifies the user's active workspace. Fall back to file-based detection only when CWD isn't in a recognizable workspace (no codev/ or .git/ directory).

Test Plan

  • Regression test added (bugfix-535-af-open-cross-workspace.test.ts)
  • Updated bugfix-500 test to reflect CWD-first with file fallback approach
  • Build passes
  • All existing af open tests pass (bugfix-427, bugfix-500, bugfix-502)

@waleedkadous waleedkadous force-pushed the builder/bugfix-535-af-open-does-not-reliably-work branch from 7df1027 to fc2f8c6 Compare February 23, 2026 23:30
…ace file opens

Root cause: open.ts derived workspace from the file's location
(findWorkspaceRoot(dirname(filePath))). When running af open from
workspace A targeting a file in workspace B, the file opened in B's
viewer instead of A's.

Fix: Prefer CWD-based workspace detection so files open in the user's
active workspace. Fall back to file-based detection when CWD isn't in
a recognizable workspace (e.g., running from /tmp).
@waleedkadous waleedkadous force-pushed the builder/bugfix-535-af-open-does-not-reliably-work branch from fc2f8c6 to 61d8b10 Compare February 23, 2026 23:31
@waleedkadous
Copy link
Contributor Author

Architect Integration Review

Verdict: APPROVE

Correct fix for cross-workspace file resolution. CWD-first with file-based fallback preserves #500's fix while solving #535. Test coverage is solid.


Architect integration review

@waleedkadous waleedkadous merged commit bcb4730 into main Feb 23, 2026
6 checks passed
@waleedkadous waleedkadous deleted the builder/bugfix-535-af-open-does-not-reliably-work branch February 23, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

af open does not reliably work on files outside the current directory

1 participant